CentOS 7
Sponsored Link

OpenStack Mitaka : How to use Manila
2016/05/13
 
How to use OpenStack Shared File System (Manila).
This example shows to install Shared File Systems on the existing environment like follows.
                                    |
+----------------------+            |            +-----------------------+
|   [ Control Node ]   |            |            |   [ Network Node ]    |
|       Keystone       |10.0.0.30   |   10.0.0.50|       DHCP Agent      |
|        Glance        |------------+------------|       L3 Agent        |
|       Nova API       |eth0        |        eth0|       L2 Agent        |
|    Neutron Server    |            |            |    Metadata Agent     |
|      Cinder API      |            |            |    Cinder Volume      |
|      Manila API      |            |            |                       |
+----------------------+            |            +-----------------------+
                                eth0|10.0.0.51
                        +----------------------+
                        |   [ Compute Node ]   |
                        |     Nova Compute     |
                        |       L2 Agent       |
                        |     Manila Share     |
                        +----------------------+

[1] Download official Manila service image and add it into Glance.
[root@dlp ~(keystone)]#
curl -O http://tarballs.openstack.org/manila-image-elements/images/manila-service-image-master.qcow2

[root@dlp ~(keystone)]#
glance image-create --name "manila-service-image" --file manila-service-image-master.qcow2 --disk-format qcow2 --container-format bare --visibility public

+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 2383a1cce8b45083c38a02c1975948e5     |
| container_format | bare                                 |
| created_at       | 2016-05-13T12:12:19Z                 |
| disk_format      | qcow2                                |
| id               | f1923aa9-9a28-4092-b9b4-7c28ed63d0d5 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | manila-service-image                 |
| owner            | 7a160aeddebd4e398fd22e6491f10baa     |
| protected        | False                                |
| size             | 302120960                            |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2016-05-13T12:12:24Z                 |
| virtual_size     | None                                 |
| visibility       | public                               |
+------------------+--------------------------------------+
[2] Create default share type.
[root@dlp ~(keystone)]#
manila type-create default_share_type True

+----------------------+--------------------------------------+
| Property             | Value                                |
+----------------------+--------------------------------------+
| required_extra_specs | driver_handles_share_servers : True  |
| Name                 | default_share_type                   |
| Visibility           | public                               |
| is_default           | -                                    |
| ID                   | 2a6d88df-6dd1-4a7d-b3a4-537dded778c2 |
| optional_extra_specs | snapshot_support : True              |
+----------------------+--------------------------------------+

[root@dlp ~(keystone)]#
manila type-list

+-----------+--------------------+------------+------------+-------------------------------------+-------------------------+
| ID        | Name               | visibility | is_default | required_extra_specs                | optional_extra_specs    |
+-----------+--------------------+------------+------------+-------------------------------------+-------------------------+
| 2a6d88df- | default_share_type | public     | YES        | driver_handles_share_servers : True | snapshot_support : True |
+-----------+--------------------+------------+------------+-------------------------------------+-------------------------+
[3] Create shared network.
[root@dlp ~(keystone)]#
neutron net-list

+--------------------------------------+---------+-------------------------------------------------------+
| id                                   | name    | subnets                                               |
+--------------------------------------+---------+-------------------------------------------------------+
| 550b379c-90f6-4cff-8063-88167dc7c568 | ext_net | 702832ef-4de5-41ba-9c2c-de2450d15ab0 10.0.0.0/24      |
| a8705bd3-c2de-4526-aa7c-2c4605a6edf4 | int_net | f29ee9fd-7bae-40d8-8d4c-a1340092f258 192.168.100.0/24 |
+--------------------------------------+---------+-------------------------------------------------------+

[root@dlp ~(keystone)]#
INT_NET=$(neutron net-list | grep 'int_net' | awk '{print $2}')

[root@dlp ~(keystone)]#
INT_SUBNET=$(neutron net-list | grep 'int_net' | awk '{print $6}')
[root@dlp ~(keystone)]#
manila share-network-create --neutron-net-id $INT_NET --neutron-subnet-id $INT_SUBNET --name manila_share

+-------------------+--------------------------------------+
| Property          | Value                                |
+-------------------+--------------------------------------+
| name              | manila_share                         |
| segmentation_id   | None                                 |
| created_at        | 2016-05-13T12:15:24.950733           |
| neutron_subnet_id | f29ee9fd-7bae-40d8-8d4c-a1340092f258 |
| updated_at        | None                                 |
| network_type      | None                                 |
| neutron_net_id    | a8705bd3-c2de-4526-aa7c-2c4605a6edf4 |
| ip_version        | None                                 |
| nova_net_id       | None                                 |
| cidr              | None                                 |
| project_id        | 7a160aeddebd4e398fd22e6491f10baa     |
| id                | 9bc87475-aa91-40e8-ab10-473273ae393b |
| description       | None                                 |
+-------------------+--------------------------------------+

[root@dlp ~(keystone)]#
manila share-network-list

+--------------------------------------+--------------+
| id                                   | name         |
+--------------------------------------+--------------+
| 9bc87475-aa91-40e8-ab10-473273ae393b | manila_share |
+--------------------------------------+--------------+
[4] Create NFS shared.
[root@dlp ~(keystone)]#
manila create NFS 1 --name share01 --share-network manila_share --share-type default_share_type

+-----------------------------+--------------------------------------+
| Property                    | Value                                |
+-----------------------------+--------------------------------------+
| status                      | creating                             |
| share_type_name             | default_share_type                   |
| description                 | None                                 |
| availability_zone           | None                                 |
| share_network_id            | 9bc87475-aa91-40e8-ab10-473273ae393b |
| share_server_id             | None                                 |
| host                        |                                      |
| access_rules_status         | active                               |
| snapshot_id                 | None                                 |
| is_public                   | False                                |
| task_state                  | None                                 |
| snapshot_support            | True                                 |
| id                          | d3d4e828-0ed5-4bf1-8f3c-2e0eaa975a14 |
| size                        | 1                                    |
| name                        | share01                              |
| share_type                  | 2a6d88df-6dd1-4a7d-b3a4-537dded778c2 |
| has_replicas                | False                                |
| replication_type            | None                                 |
| created_at                  | 2016-05-13T12:26:54.000000           |
| share_proto                 | NFS                                  |
| consistency_group_id        | None                                 |
| source_cgsnapshot_member_id | None                                 |
| project_id                  | 7a160aeddebd4e398fd22e6491f10baa     |
| metadata                    | {}                                   |
+-----------------------------+--------------------------------------+

# few minutes later, the Status turns to available

[root@dlp ~(keystone)]#
manila list

+-----------+---------+------+-------------+-----------+-----------+--------------------+--------------------------------------+-------------------+
| ID        | Name    | Size | Share Proto | Status    | Is Public | Share Type Name    | Host                                 | Availability Zone |
+-----------+---------+------+-------------+-----------+-----------+--------------------+--------------------------------------+-------------------+
| d3d4e828- | share01 | 1    | NFS         | available | False     | default_share_type | node01.srv.world@backend01#backend01 | nova              |
+-----------+---------+------+-------------+-----------+-----------+--------------------+--------------------------------------+-------------------+
[5] At this point, 10.254.0.0/16 network has been created which is specified in manila.conf on Compute Node, and it's possible to login to Manila service instance from Compute Node like follows.
[root@node01 ~]#
ip addr

.....
.....
12: tap4b9bdd40-8e: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    link/ether fa:16:3e:c9:f2:ef brd ff:ff:ff:ff:ff:ff
    inet 10.254.0.4/28 brd 10.254.0.15 scope global tap4b9bdd40-8e
       valid_lft forever preferred_lft forever
    inet6 fe80::f816:3eff:fec9:f2ef/64 scope link
       valid_lft forever preferred_lft forever
.....
.....

# login with a user and password which you specified in manila.conf

[root@node01 ~]#
ssh manila@10.254.0.3

The authenticity of host '10.254.0.3 (10.254.0.3)' can't be established.
ECDSA key fingerprint is 49:9c:e4:ed:82:93:fb:ec:37:47:85:e6:28:6f:bd:ac.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.254.0.3' (ECDSA) to the list of known hosts.
manila@10.254.0.3's password:
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-85-generic i686)

 * Documentation:  https://help.ubuntu.com/

manila@localhost:~$

manila@localhost:~$
df -hT

Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs  999M  4.0K  999M   1% /dev
tmpfs          tmpfs     202M  492K  202M   1% /run
/dev/vda1      ext4      1.2G  738M  338M  69% /
none           tmpfs     4.0K     0  4.0K   0% /sys/fs/cgroup
none           tmpfs     5.0M     0  5.0M   0% /run/lock
none           tmpfs    1008M     0 1008M   0% /run/shm
none           tmpfs     100M     0  100M   0% /run/user
/dev/vdb       ext4      976M  1.3M  908M   1% /shares/share-a5d8d0f5-40ac-4c9a-94c8-3b88687d0820
[6] It's OK all, you can use Manila Shared filesystem from anInstance like follows.
# allow access rights first

[root@dlp ~(keystone)]#
manila access-allow share01 ip 192.168.100.0/24 --access-level rw

+--------------+--------------------------------------+
| Property     | Value                                |
+--------------+--------------------------------------+
| share_id     | d3d4e828-0ed5-4bf1-8f3c-2e0eaa975a14 |
| access_type  | ip                                   |
| access_to    | 192.168.100.0/24                     |
| access_level | rw                                   |
| state        | new                                  |
| id           | b7aded18-2f55-492d-a225-34c482351888 |
+--------------+--------------------------------------+

[root@dlp ~(keystone)]#
nova list

+-----------+----------+---------+------------+-------------+-----------------------------------+
| ID        | Name     | Status  | Task State | Power State | Networks                          |
+-----------+----------+---------+------------+-------------+-----------------------------------+
| 4e232450- | CentOS_7 | SHUTOFF | -          | Shutdown    | int_net=192.168.100.3, 10.0.0.201 |
+-----------+----------+---------+------------+-------------+-----------------------------------+

[root@dlp ~(keystone)]#
nova start CentOS_7

Request to start server CentOS_7 has been accepted.
[root@dlp ~(keystone)]#
ssh 10.0.0.201

root@10.0.0.201's password:
Last login: Mon May 9 20:47:50 2016 from 10.0.0.30
[root@host-192-168-100-3 ~]#
mount -t nfs 10.254.0.3:/shares/share-a5d8d0f5-40ac-4c9a-94c8-3b88687d0820 /mnt

[root@host-192-168-100-3 ~]#
df -hT

Filesystem                                                    Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root                                       xfs       8.5G  929M  7.6G  11% /
devtmpfs                                                      devtmpfs  991M     0  991M   0% /dev
tmpfs                                                         tmpfs    1001M     0 1001M   0% /dev/shm
tmpfs                                                         tmpfs    1001M  8.3M  993M   1% /run
tmpfs                                                         tmpfs    1001M     0 1001M   0% /sys/fs/cgroup
/dev/vda1                                                     xfs       497M  107M  390M  22% /boot
tmpfs                                                         tmpfs     201M     0  201M   0% /run/user/0
10.254.0.3:/shares/share-a5d8d0f5-40ac-4c9a-94c8-3b88687d0820 nfs4      976M  1.3M  908M   1% /mnt
 
Tweet